using UnityEngine;
using System.Collections;

public class LoadingScript : MonoBehaviour 
{
	public string SceneToLoad;
	
	public void Update()
	{
		if(SceneToLoad == "")
		{
			return;
		}
		
		float lPurcentage = Application.GetStreamProgressForLevel(SceneToLoad);
		
		if(lPurcentage == 1)
		{
			gameObject.SetActiveRecursively(false);
			Application.LoadLevel(SceneToLoad);
		}
		else
		{
			guiText.text = "Loading, please wait... " + (int)(100*lPurcentage) + "%";
		}
	}
	
	public void LoadLevel(string pLevel)
	{
		gameObject.SetActiveRecursively(true);
		
		SceneToLoad = pLevel;
	}
}
